import turntable from "./turntable";

export default class gameUI extends Laya.Script {

    constructor() {
        super();
        /** @prop {name:luckDrawDialog, tips:"抽奖页面", type:Node, default:null}*/
        /** @prop {name:intType, tips:"整数类型示例", type:Int, default:1000}*/
        let intType = 1000;

        // /** @prop {name:numType, tips:"数字类型示例", type:Number, default:1000}*/
        // let numType = 1000;
        // /** @prop {name:strType, tips:"字符串类型示例", type:String, default:"hello laya"}*/
        // let strType = "hello laya";
        // /** @prop {name:boolType, tips:"布尔类型示例", type:Bool, default:true}*/
        // let boolType = true;
        // 更多参数说明请访问: https://ldc2.layabox.com/doc/?nav=zh-as-2-4-0
    }

    //进入脚本执行
    onAwake() {
        //注册排行榜按钮
        this.rankBtn = this.owner.getChildByName("gameUILayer").getChildByName("openRankButton");
        this.rankBtn.on(Laya.Event.CLICK, this, this.rankBtnClick);
        //注册关闭排行榜按钮
        // let _closerank = this.owner.getChildByName("rankPanel");
        // this.closerankBtn = _closerank.getChildByName("closeRank");
        this.closerankBtn = this.owner.getChildByName("rankPanel").getChildByName("closeRank");
        this.closerankBtn.on(Laya.Event.CLICK, this, this.closeRankBtnClick);
        //排行榜页面
        this.closerankPanel = this.owner.getChildByName("rankPanel");

        //注册抽奖按钮
        this.luckDrawBtn = this.owner.getChildByName("gameUILayer").getChildByName("openLuckDrawButton");
        this.luckDrawBtn.on(Laya.Event.CLICK, this, this.luckDrawBtnClick);
        //注册关闭抽奖按钮
        let _luckDraw = this.owner.getChildByName("luckDrawPanel");
        this.closeLuckDrawBtn = _luckDraw.getChildByName("background").getChildByName("closeLuckDraw");
        this.closeLuckDrawBtn.on(Laya.Event.CLICK, this, this.closeLuckDrawBtnClick);
        //抽奖页面
        this.luckDrawPanel = this.owner.getChildByName("luckDrawPanel");

        //注册签到按钮
        this.signInBtn = this.owner.getChildByName("gameUILayer").getChildByName("openSignInButton");
        this.signInBtn.on(Laya.Event.CLICK, this, this.signInBtnClick);
        //注册关闭签到按钮
        let _signIn = this.owner.getChildByName("signInPanel");
        this.closeSignInBtn = _signIn.getChildByName("background").getChildByName("closeSignIn");
        this.closeSignInBtn.on(Laya.Event.CLICK, this, this.closeSignInBtnClick);
        //签到页面
        this.signInPanel = this.owner.getChildByName("signInPanel");

        //注册商店按钮
        this.shopBtn = this.owner.getChildByName("gameUILayer").getChildByName("openShopButton");
        this.shopBtn.on(Laya.Event.CLICK, this, this.shopBtnClick);
        //注册关闭商店按钮
        let _shop = this.owner.getChildByName("shopPanel");
        this.closeShopBtn = _shop.getChildByName("closeShop");
        this.closeShopBtn.on(Laya.Event.CLICK, this, this.closeShopBtnClick);
        //商店页面
        this.shopPanel = this.owner.getChildByName("shopPanel");


        //注册福利按钮
        this.welfareBtn = this.owner.getChildByName("gameUILayer").getChildByName("welfareButton");
        this.welfareBtn.on(Laya.Event.CLICK, this, this.welfareBtnClick);
        //注册设置按钮
        this.setUpBtn = this.owner.getChildByName("gameUILayer").getChildByName("setUpButton");
        this.setUpBtn.on(Laya.Event.CLICK, this, this.setUpBtnClick);


        //注册多人竞技赛按钮
        this.ManyPeopleSportsMatchBtn = this.owner.getChildByName("gameUILayer").getChildByName("ManyPeopleSportsMatchButton");
        this.ManyPeopleSportsMatchBtn.on(Laya.Event.CLICK, this, this.ManyPeopleSportsMatchBtnClick);
        //注册个人闯关赛按钮
        this.passStageMatchMatchBtn = this.owner.getChildByName("gameUILayer").getChildByName("passStageMatchButton");
        this.passStageMatchMatchBtn.on(Laya.Event.CLICK, this, this.passStageMatchBtnClick);
    }
    //在update之前执行
    onStart() {

    }
    //持续执行
    onUpdate() { }

    onEnable() {
    }

    onDisable() {
    }


    //排行榜按钮
    rankBtnClick() {
        console.log("排行榜按钮");
        this.closerankPanel.visible = true;
    }
    //关闭排行榜按钮
    closeRankBtnClick() {
        console.log("关闭排行榜按钮");
        this.closerankPanel.visible = false;
    }
    //抽奖按钮
    luckDrawBtnClick() {
        console.log("抽奖按钮");
        this.luckDrawPanel.visible = true;

        this.luckDrawPanel.getComponent(turntable).turntableReset();
    }
    //关闭抽奖按钮
    closeLuckDrawBtnClick() {
        console.log("关闭抽奖按钮");
        this.luckDrawPanel.visible = false;
    }
    //签到按钮
    signInBtnClick() {
        console.log("签到按钮");
        this.signInPanel.visible = true;
    }
    //关闭签到按钮
    closeSignInBtnClick() {
        console.log("关闭签到按钮");
        this.signInPanel.visible = false;
    }
    //商店按钮
    shopBtnClick() {
        console.log("商店按钮");
        this.shopPanel.visible = true;
    }
    //关闭商店按钮
    closeShopBtnClick() {
        console.log("关闭商店按钮");
        this.shopPanel.visible = false;
    }

    //福利按钮
    welfareBtnClick() {
        console.log("福利按钮");
    }
    //设置按钮
    setUpBtnClick() {
        console.log("设置按钮");
    }


    //多人竞技赛按钮
    ManyPeopleSportsMatchBtnClick() {
        console.log("多人竞技赛按钮");
    }
    //个人闯关赛按钮
    passStageMatchBtnClick() {
        console.log("个人闯关赛按钮");
    }


    ////////////////////////////////////
}